<?php
namespace app\common\model;

class Role extends Base
{
    protected $name = 'role';

    public function getMenuAttr($val){
        
        if(!$val){
            return '';
        }else{
            $menuIds = explode(',', $val);
            array_pop($menuIds);
            
            $menu = '';
            foreach($menuIds as $val){
                $menu .= (new Menu())->getVal(['id' => $val], 'name')['data'] . ',';
            }

            return $menu;
        }
    }
}